package phoenix.mob_android.page_objects;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.PageBaseMobAndroidExt;
import phoenix.core.config.extensions.ConfigExt;
import phoenix.mob_android.locators.base.MainMenuLocatorsBase;

public class MainMenu extends PageBaseMobAndroidExt
{
	public MainMenu(PhoenixManager p_manager)
	{
		super(p_manager);
	}

	/**
	 * Gets web elements by site
	 * @return MainMenuLocatorsBase instance
	 */
	public MainMenuLocatorsBase elements()
	{
		switch (manager.testModel().getSiteName())
		{
			case ConfigExt.SITE_ID_FLIRT:
			{
				return new phoenix.mob_android.locators.flirt.MainMenuLocators();
			}
			case ConfigExt.SITE_ID_WILDBUDDIES:
			{
				return new phoenix.mob_android.locators.wildbuddies.MainMenuLocators();
			}
			case ConfigExt.SITE_ID_CHEECKYLOVERS:
			{
				return new phoenix.mob_android.locators.cheeckylovers.MainMenuLocators();
			}
			default:
			{
				return null;
			}
		}
	}

	public MainMenu openMainMenu()
	{
		md().waitForVisibility(elements().btnOpenMainMenu, "Open main menu button doesn't appear");
		md().click(elements().btnOpenMainMenu);

		return this;
	}

	public void clickFeatureSelectionButton()
	{
		md().waitForVisibility(elements().btnFutureUpgradeBunner, "Feature selection upgrade bunner doesn't appear");
		md().click(elements().btnFutureUpgradeBunner);
	}

	public void clickUpgradeButton()
	{
		md().waitForPresence(elements().btnUpgrade, "Upgrade button doesn't appear in the main menu");
		md().click(elements().btnUpgrade);
	}

	public void clickFeaturesBanner()
	{
		md().waitForVisibility(elements().btnFeatureUpgrade, "Features upgrade bunner doesn't appear");
		md().click(elements().btnFeatureUpgrade);
	}

	public boolean isFeatureBunnerVisible()
	{
		return md().isElementDisplayed(elements().btnFeatureUpgrade);
	}

	public MainMenu openMyProfile()
	{
		md().waitForVisibility(elements().btnMyProfile, "Button My Profile doesn't appear");
		md().click(elements().btnMyProfile);

		return this;
	}

	public MainMenu openChatBottomMenu()
	{
		md().waitForVisibility(elements().btnChatBottomMenu, "Button Chat bottom menu doesn't appear");
		md().click(elements().btnChatBottomMenu);

		return this;
	}

	public MainMenu openActivityBottomMenu()
	{
		md().waitForVisibility(elements().btnActivityBottomMenu, "Button Activity bottom menu doesn't appear");
		md().click(elements().btnActivityBottomMenu);

		return this;
	}

	public MainMenu openSearchBottomMenu()
	{
		md().waitForVisibility(elements().btnSearchBottomMenu, "Button Search bottom menu doesn't appear");
		md().click(elements().btnSearchBottomMenu);

		return this;
	}

	public MainMenu openFavouriteBottomMenu()
	{
		md().waitForVisibility(elements().btnFavouriteBottomMenu, "Button Favourite bottom menu doesn't appear");
		md().click(elements().btnFavouriteBottomMenu);

		return this;
	}

	public MainMenu openPhotos()
	{
		md().waitForVisibility(elements().btnPhotos, "Button photos doesn't appear in the main menu");
		md().click(elements().btnPhotos);

		return this;
	}

	public MainMenu openSettings()
	{
		md().waitForVisibility(elements().btnSettings, "Button Settings doesn't appear in the main menu");
		md().click(elements().btnSettings);

		return this;
	}

	public MainMenu openChatRooms()
	{
		md().waitForVisibility(elements().btnChatRooms, "Button Chat rooms doesn't appear in the main menu");
		md().click(elements().btnChatRooms);

		return this;
	}

	public MainMenu openActivity()
	{
		md().waitForVisibility(elements().btnActivity, "Button Activity doesn't appear in the main menu");
		md().click(elements().btnActivity);

		return this;
	}

	public MainMenu openFavourites()
	{
		md().waitForVisibility(elements().btnFavourites, "Button Favourites doesn't appear in the main menu");
		md().click(elements().btnFavourites);

		return this;
	}

	public MainMenu openLikeOrNot()
	{
		md().waitForVisibility(elements().btnLikeOrNot, "Button Like or not doesn't appear in the main menu");
		md().click(elements().btnLikeOrNot);

		return this;
	}

	public MainMenu openSearch()
	{
		md().waitForVisibility(elements().btnSearch, "Button Search doesn't appear in the main menu");
		md().click(elements().btnSearch);

		return this;
	}
}
